package com.jomoo.remark.service.impl;

import java.util.Date;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.jomoo.common.exception.RemarkException;
import com.jomoo.common.pojo.JoMooRemark;
import com.jomoo.remark.dao.RemarkDao;
import com.jomoo.remark.service.RemarkService;

/**
 * 
* @ClassName: RemarkServiceImpl 
* @Description: 下拉菜单逻辑接口实现 
* @author sddm.haosc
* @date 2017年12月12日 上午10:46:25 
*
 */
@Service("remarkServiceImpl")
@Transactional(rollbackFor = RemarkException.class)
public class RemarkServiceImpl implements RemarkService
{

	@Resource
	public RemarkDao remarkDao;

	/**
	 * 备忘录录入
	 */
	@Override
	public Integer addRemark(String strTitle, String strContent) throws RemarkException
	{
		JoMooRemark remark = new JoMooRemark();

		Integer iAcId = null;

		try
		{
			remark.setTitle(strTitle);
			remark.setContent(strContent);
			remark.setRemarkTime(new Date());

			iAcId = remarkDao.saveAllObj(remark);

		}
		catch (Exception e)
		{
			e.printStackTrace();
			new RemarkException("保存备忘录异常：" + e.getMessage());
		}
		return iAcId;
	}
}
